<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #browserType {
            position: absolute;
            color: #8a8a8a;
            font-size: 16px;
            bottom: 10px;
            right: 10px;
            background-color: black;
            border-radius: 5px;
            width: 350px;
            height: 30px;
            line-height: 30px;
            text-align: center;
        }
    </style>
</head>

<body>
    <div id="browserType"></div>
    <script>
        // 获取用户使用的浏览器类型的立即执行函数
        (function () {
            var info = navigator.userAgent;
            var type;
            if (info.search(/firefox/i) >= 0) type = "firefox";
            else if (info.search(/chrome/i) >= 0) type = "chrome";
            else if (info.search(/msie/i)) type = "ie";
            browserType.innerHTML = "您当前使用的是" + type + "浏览器"
        }())
    </script>
</body>

</html>